var util = require('../../../utils/util.js');
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.showLoading({
      title: '加载中...',
    })
    wx.getStorage({
      key: 'userInfo',
      success: function (res) {
        that.setData({
          userInfo: res.data
        })
       util.getReq("/app/home/allApartmentInterface", {
        source: res.data.source,
        uid: res.data.user_id,

      }, function (datas) {
        wx.hideLoading();
        if (datas.code == 0) {
          that.setData({
            dataList: datas.params.list
          })

        } else {
          wx.showToast({
            title: datas.desc,
          })
        }

      })
    }, fail: function () {
      wx.redirectTo({
        url: '/pages/index/index',
      })
    }
  });
   
  },

  
  /**
   * 跳转至单价配置页面
   */
  nagtiveToDj:function(){
      wx.navigateTo({
        url: '/pages/home/price/price_list',
      })
  },
/**
 * 跳转至账单页面
 */
  nagtiveToZd: function () {
    wx.navigateTo({
      url: '/pages/home/zhangdan/zhandan_list',
    })
  },
  /**
   * 跳转至房间抄表页面
   */
  nagtiveToRoom:function(e){
    wx.navigateTo({
      url: '/pages/home/roomSign/roomSign_list?apartment_id=' + e.currentTarget.dataset.apartmentid + "&apartment_name=" + e.currentTarget.dataset.apartment_name,
    })
  },
  /**
  * 页面相关事件处理函数--监听用户下拉动作
  */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh(true);
  },

  })